import request from '@/router/axios';
import {downloadExcel} from '@/router/axios';
import {formatCondition} from '@/util/util';
//单条查询
export const querySysDynamicForm = (params) => {
  params.head.transCode = 'querySysDynamicForm';
  return request({
    url: '/platform/sysDynamicForm/querySysDynamicForm',
    method: 'post',
    data: params
  })
}
//多条列表查询，支持条件查询
export const querySysDynamicFormListPage = (params) => {
  params.head.transCode = 'querySysDynamicFormListPage';
  return request({
    url: '/platform/sysDynamicForm/querySysDynamicFormListPage',
    method: 'post',
    data: params
  })
}
//新增单条记录
export const saveSysDynamicForm = (params) => {
  params.head.transCode = 'saveSysDynamicForm';
  return request({
    url: '/platform/sysDynamicForm/saveSysDynamicForm',
    method: 'post',
    data: params
  })
}
//新增或修改单条记录
export const saveOrUpdateSysDynamicForm = (params) => {
  params.head.transCode = 'saveOrUpdateSysDynamicForm';
  return request({
    url: '/platform/sysDynamicForm/saveOrUpdateSysDynamicForm',
    method: 'post',
    data: params
  })
}


//新增或修改单条记录
export const saveOrUpdateSysDynamicFormList = (params) => {
  params.head.transCode = 'saveOrUpdateSysDynamicFormList';
  return request({
    url: '/platform/sysDynamicForm/saveOrUpdateSysDynamicFormList',
    method: 'post',
    data: params
  })
}

//修改单条记录
export const updateSysDynamicForm = (params) => {
  params.head.transCode = 'updateSysDynamicForm';
  return request({
    url: '/platform/sysDynamicForm/updateSysDynamicForm',
    method: 'post',
    data: params
  })
}

//删除单条记录
export const deleteSysDynamicForm = (params) => {
  params.head.transCode = 'deleteSysDynamicForm';
  return request({
    url: '/platform/sysDynamicForm/deleteSysDynamicForm',
    method: 'post',
    data: params
  })
}

//删除多条记录
export const deleteSysDynamicFormList = (params) => {
  params.head.transCode = 'deleteSysDynamicFormList';
  return request({
    url: '/platform/sysDynamicForm/deleteSysDynamicFormList',
    method: 'post',
    data: params
  })
}
//导出excel
export const exportSysDynamicFormExcel = (params) => {
  downloadExcel({
    url: '/platform/sysDynamicForm/excelDownload/exportSysDynamicFormExcel',
    method: 'get',
    data: 
    {
      tenantId: params.head.tenantId,
      orders:'',
      condition: formatCondition(params.body.sqlCondition)
    }
  })
}
